<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>系统名称: {{title}}</h1>
        <ul>
            <li v-for="(item, i) in products">
                名称：{{item.name}}
                <button @click="item.stock--"> -</button>
                <span>{{item.stock}}</span>
                <button @click="item.stock++">+</button>
                <button @click="remove(i)">删除</button>
            </li>
        </ul>
        
    </div>
    <script src="./vue.min.js"></script>
    <script>
        var vm = new Vue({ //配置
            el: "#app" ,//css选择器
            data: {
                title: "库存管理系统",
                products: [
                    {name: "iphone", stock: 10},
                    {name: "xiaomi", stock: 5},
                    {name: "huawei", stock: 6},
                ],
            },
            methods:{
                remove(i){
                    this.products.splice(i,1);
                }
            }
        })
    </script>
</body>
</html>